<%@ page import="com.zx.work1.bean.User" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>主页面</title>
    <link href="css/bootstrap.min.css" rel="stylesheet" />
</head>
<body style="padding:100px">
<table class="table table-responsive">
    <!-- 定义操作窗口 -->
    <div class="form-inline" >
        <button id="b1" class="btn btn-primary" data-toggle="modal" data-target="#myModal">新增</button>
        <button id="b3" class="btn btn-primary" data-toggle="modal" data-target="#myModal1">编辑</button>
        <button id="b6" class="btn btn-primary" data-toggle="modal" data-target="#myModal2">删除</button>

        <form action="queryStudentNum" method="post">
            <input type="text" class="form-control" placeholder="按工号查询" name="studentNum">
            <button type="submit" class="btn btn-primary">查询</button>
        </form>


<%--        <button id="b4" class="btn btn-primary">查询</button>--%>
<%--        <input type="text" class="form-control" placeholder="按工号查询" id="quary1">--%>
<%--        <input type="text" class="form-control" placeholder="按姓名查询" id="quary2">--%>
<%--        <button id="b5" class="btn btn-primary btn-xs">返回</button>--%>
    </div>
    <!-- 定义表头 -->
    <thead>
    <tr>
        <th>序号</th>
        <th>学号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>出生日期</th>
        <th>邮箱</th>
        <th>备注</th>

    </tr>
    </thead>
    <!-- 定义四个成员 -->
    <tbody id="listTable">
<%
    List<Object[]> studentList = (List<Object[]>)session.getAttribute("originalList");
        for(int i=0;i<studentList.size();i++){
            Object[] student = studentList.get(i);
%>
    <tr class="info">
        <td>
            <input type="checkbox"  name="item"/>
        </td>
        <td ><%=student[1]%></td>
        <td><%=student[2]%></td>
        <td><%=student[3]%></td>
        <td><%=student[4]%></td>
        <td><%=student[5]%></td>
        <td><%=student[6]%></td>
    </tr>
<%
    }
%>
    </tbody>
</table>

<span style="color: red"><%= request.getAttribute("error")==null?"":request.getAttribute("error")%></span><br/>

<!-- 声明定义模态框组件 -->
<div class="modal" id="myModal" data-backdrop="static">
    <!-- 窗口声明 -->
    <div class="modal-dialog">
        <!-- 内容声明 -->
        <div class="modal-content">
            <!-- 1.框的标题 -->
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">请新增用户</h4>
            </div>
            <!-- 2.框内信息 -->
            <h1>新增数据</h1>
            <form action="addStudent" id="form1" method="post">
                <table class="table table-hover table-bordered">
                    <tr>
                        <th>工号</th>
                        <td><input type="text" name="studentNum" class="form-control" id="num1" /></td>
                    </tr>
                    <tr>
                        <th>姓名</th>
                        <td><input type="text" name="studentName" class="form-control" id="username1" /></td>
                    </tr>
                    <tr>
                        <th>性别</th>
                        <td><input type="text" name="studentSex" class="form-control" id="sex1" /></td>
                    </tr>
                    <tr>
                        <th>出生日期</th>
                        <td><input type="date" name="studentData" class="form-control" id="birth1" /></td>
                    </tr>
                    <tr>
                        <th>邮箱</th>
                        <td><input type="text" name="studentMail" class="form-control" id="pwd1" /></td>
                    </tr>
                    <tr>
                        <th>备注</th>
                        <td><input type="text" name="studentRemark" class="form-control" id="age1" /></td>
                    </tr>

                    <tr>
                        <td colspan="2">
                            <input type="reset" value="重置" class="btn btn-primary" id="reset" />
                            <input type="submit" value="添加" class="btn btn-success" id="b11"  />
                        </td>
                    </tr>
                </table>
            </form>
            <!-- 3.框的按钮 -->
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal">返回
                </button>
            </div>
        </div>
    </div>
</div>

<!-- 声明定义编辑模态框组件 -->
<div class="modal" id="myModal1" data-backdrop="static">
    <!-- 窗口声明 -->
    <div class="modal-dialog">
        <!-- 内容声明 -->
        <div class="modal-content">
            <!-- 1.框的标题 -->
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">请修改用户</h4>
            </div>
            <!-- 2.框内信息 -->
            <h1>修改数据</h1>
            <form action="modifyStudent" id="form2" method="post">
                <table class="table table-hover table-bordered">
                    <tr>
                        <th>工号</th>
                        <td><input type="text" name="studentNum" class="form-control" id="num2" /></td>
                    </tr>
                    <tr>
                        <th>姓名</th>
                        <td><input type="text" name="studentName" class="form-control" id="username2" /></td>
                    </tr>
                    <tr>
                        <th>性别</th>
                        <td><input type="text" name="studentSex" class="form-control" id="sex2" /></td>
                    </tr>
                    <tr>
                        <th>出生日期</th>
                        <td><input type="date" name="studentData" class="form-control" id="birth2" /></td>
                    </tr>
                    <tr>
                        <th>邮箱</th>
                        <td><input type="text" name="studentMail" class="form-control" id="pwd2" /></td>
                    </tr>
                    <tr>
                        <th>备注</th>
                        <td><input type="text" name="studentRemark" class="form-control" id="age2" /></td>
                    </tr>


                    <tr>
                        <td colspan="2">
                            <input type="reset" value="重置" class="btn btn-primary" id="reset1" />
                            <input type="submit" value="更新"  class="btn btn-info" id="b33"  />
                        </td>
                    </tr>
                </table>
            </form>
            <!-- 3.框的按钮 -->
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal">返回
                </button>
            </div>
        </div>
    </div>
</div>

<!-- 声明定义删除模态框组件 -->
<div class="modal" id="myModal2" data-backdrop="static">
    <!-- 窗口声明 -->
    <div class="modal-dialog">
        <!-- 内容声明 -->
        <div class="modal-content">
            <!-- 1.框的标题 -->
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">请修改用户</h4>
            </div>
            <!-- 2.框内信息 -->
            <h1>请输入要删除的学号数据</h1>
            <form action="delStudent" id="form3" method="post">
                <table class="table table-hover table-bordered">
                    <tr>
                        <th>工号</th>
                        <td><input type="text" name="studentNum" class="form-control" id="num3" /></td>
                    </tr>

                    <tr>
                        <td colspan="2">
                            <input type="reset" value="重置" class="btn btn-primary" id="reset2" />
                            <input type="submit" value="删除"  class="btn btn-info" id="b44"  />
                        </td>
                    </tr>
                </table>
            </form>
            <!-- 3.框的按钮 -->
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal">返回
                </button>
            </div>
        </div>
    </div>
</div>

<!-- jQuery (Bootstrap 的 JavaScript 插件需要引入 jQuery) -->
<script src="js/jquery-3.3.1.min.js"></script>
<!-- 包括所有已编译的插件 -->
<script src="js/bootstrap.min.js"></script>
<!-- 导入增删改查文件 -->
<script src="js/curd.js"></script>
<script>
    // 修改按钮边距
    $("button").innerWidth(
        function(){
            $(this).css("border","2px solid white");
        }
    );
</script>
</body>
</html>
